﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace _6.EncodesAndDecodesString
{
    class EncodesAndDecodesString
    {
        static List<int> Cript(string text, string key)
        {
            List<int> cripted = new List<int>();
            for (int i = 0; i < text.Length; i++)
            {
                cripted.Add((ushort)text[i] ^ (ushort)key[i % key.Length]);
            }
            return cripted;
        }
        static void Main(string[] args)
        {
            string text = "Nakov";
            Console.WriteLine("The text is:{0}",text);
            string key = "ab";
            Console.WriteLine("Encryption key is:{0}",key);
            List<int> criptedText = Cript(text,key);
            Console.Write("Cripted text:");
            foreach (var item in criptedText)
            {
                Console.Write("\\u{0:x4}",item);
            }
            Console.WriteLine();
        }
    }
}
